/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package drinkcounter.util;

import com.google.inject.Provider;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author Toni
 */
public class EntityManagerProvider  implements Provider<EntityManager>{
    private EntityManagerFactory factory;

        public EntityManagerProvider() {
            factory = Persistence.createEntityManagerFactory("transactions-optional");
        }

        @Override
        public EntityManager get() {
            return factory.createEntityManager();
        }
}
